package cn.moukou.tongji.ihealth.patient.service;

import cn.moukou.tongji.ihealth.patient.dao.PatientMapper;
import cn.moukou.tongji.ihealth.patient.pojo.Patient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientService {

    @Autowired
    PatientMapper patientMapper;

    public int insertOne(String id, String name, int age, String sex, String phoneNumber, String password) {
        Patient patient = new Patient();
        patient.setId(id);
        patient.setName(name);
        patient.setAge(age);
        patient.setSex(sex);
        patient.setPhoneNumber(phoneNumber);
        patient.setPassword(password);
        return patientMapper.insert(patient);
    }

    public Patient getOne(String id) {
        return patientMapper.selectById(id);
    }

    public List<Patient> getAll() {
        return patientMapper.selectList(null);
    }

}
